package com.itrus.spring.inject.controller;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class InjectValueController {

    /**
     * 源码分析：
     * AutowiredAnnotationBeanPostProcessor.postProcessProperties
     * propertyResolver.resolveRequiredPlaceholders(strVal)
     * PropertySourcesPropertyResolver.getProperty
     */

    @Value("${user.language}")
    private String language;

    @Value("${user.id}")
    private String id;

    @RequestMapping(path = "/inject/value")
    public String value() {
        return id + "(" + language + ")";
    }
}